﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FretBoard
{
    class Scale
    {
        string root;

        public Scale(string _root)
        {
            root = _root;
        }

        public List<string> getScale(string scaleType)
        {
            var scaleNotes = new List<string>();
            List<int> intervals = new List<int>();
            if (scaleType == "Major")
            {
                intervals = new List<int>() { 2, 3, 4, 7, 9, 11, 12 };
            }
            else if (scaleType == "Minor")
            {
                intervals = new List<int>() { 2, 3, 5, 7, 8, 10, 12 };
            }

            foreach (var val in intervals)
            {
                scaleNotes.Add(root);
                scaleNotes.Add(Notes.getNote(root,val));
            }

            return scaleNotes;
        }

        public string getScale(string scaleType, StringBuilder sb)
        {
            var scaleNotes = new List<string>();
            List<int> intervals = new List<int>();
            if (scaleType == "Major")
            {
                intervals = new List<int>() { 2, 4, 5, 7, 9, 11, 12 };
            }
            else if (scaleType == "Minor")
            {
                intervals = new List<int>() { 2, 3, 5, 7, 8, 10, 12 };
            }

            sb.Append(root.ToUpper());
            foreach (var val in intervals)
            {
               sb.Append(",");
               sb.Append(Notes.getNote(root, val));
            }

            return sb.ToString();
        }
    }
}
